package com.danceforyou.common.vo;

import java.io.Serializable;

public class BizData<T> implements Serializable {

    private static final long serialVersionUID = 5369667759174813049L;

    private String code;
    private String msg;
    private long timestamp;
    private T data;

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public BizData(T data) {
        this.code = BizCodeEnum.SUCCESS.getCode();
        this.msg = BizCodeEnum.SUCCESS.getMsg();
        this.timestamp = System.currentTimeMillis();
        this.data = data;
    }

    public BizData(String code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.timestamp = System.currentTimeMillis();
        this.data = data;
    }

    public BizData(BizCodeEnum bizCode) {
        this.code = bizCode.getCode();
        this.msg = bizCode.getMsg();
        this.timestamp = System.currentTimeMillis();
    }
}
